﻿using System.Text;

namespace eAtlantida.Tools.Generator
{
    public static class StringBuilderExtension
    {
        public const string Tab = "    ";

        public static void Append(this StringBuilder sb, int countTabs, string str)
        {
            for (var i = 0; i < countTabs; i++)
            {
                sb.Append(Tab);
            }
            sb.Append(str);
        }

        public static void AppendLine(this StringBuilder sb, int countTabs, string str)
        {
            Append(sb, countTabs, str);
            sb.AppendLine();
        }

        public static void Append(this StringBuilder sb, int countTabs, params string[] strings)
        {
            for (var i = 0; i < countTabs; i++)
            {
                sb.Append(Tab);
            }
            foreach (var str in strings)
            {
                sb.Append(str);
            }
        }

        public static void AppendLine(this StringBuilder sb, int countTabs, params string[] strings)
        {
            Append(sb, countTabs, strings);
            sb.AppendLine();
        }

        public static void Append(this StringBuilder sb, params string[] strings)
        {
            foreach (var str in strings)
            {
                sb.Append(str);
            }
        } 

        public static void AppendLine(this StringBuilder sb, params string[] strings)
        {
            Append(sb, strings);
            sb.AppendLine();
        } 
    }
}